home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-06-28 | 3.2 KB | 160 lines | [TEXT/CWIE] |
- // GrowOnRightArrangement.cp
-
- #ifndef GrowOnRightArrangement_h
- #include "GrowOnRightArrangement.h"
- #endif
- #ifndef MinMax_h
- #include "MinMax.h"
- #endif
-
- GrowOnRightArrangement::GrowOnRightArrangement( WindowFocus& focus )
- : grow( focus )
- {
- RightLine().SetView( rightLine );
- Grow().SetView( grow );
- }
-
- void GrowOnRightArrangement::Arrange( Rectangle bounds )
- {
- Rectangle grow( bounds.right - barSize,
- bounds.bottom - barSize,
- bounds.right,
- bounds.bottom );
-
- Rectangle main( bounds.left,
- bounds.top,
- grow.left,
- bounds.bottom );
-
- Rectangle rightLine( grow.left,
- bounds.top,
- grow.left + 1,
- grow.top );
-
- Rectangle rightBar( rightLine.right,
- bounds.top,
- bounds.right,
- grow.top );
-
- Main().SetBounds( main );
- Right().SetBounds( rightBar );
- RightLine().SetBounds( rightLine );
- Grow().SetBounds( grow );
- }
-
- uint16 GrowOnRightArrangement::MinimumHeight() const
- {
- uint16 size = Right().Size().MinimumHeight();
-
- Assert( size <= maxint16 - barSize );
-
- size += barSize;
-
- return Max( size, Main().Size().MinimumHeight() );
- }
-
- uint16 GrowOnRightArrangement::MinimumWidth() const
- {
- uint16 size = Main().Size().MinimumWidth();
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-
- uint16 GrowOnRightArrangement::MaximumHeight() const
- {
- uint16 size = Right().Size().MaximumHeight();
-
- if ( size >= maxint16 - barSize )
- size = maxint16;
- else
- size += barSize;
-
- return Max( size, Main().Size().MaximumHeight() );
- }
-
- uint16 GrowOnRightArrangement::MaximumWidth() const
- {
- uint16 size = Main().Size().MaximumWidth();
-
- if ( size >= maxint16 - barSize )
- return maxint16;
-
- return size + barSize;
- }
-
- uint16 GrowOnRightArrangement::ReasonableHeight() const
- {
- uint16 size = Right().Size().ReasonableHeight();
-
- Assert( size <= maxint16 - barSize );
-
- size += barSize;
-
- return Max( size, Main().Size().ReasonableHeight() );
- }
-
- uint16 GrowOnRightArrangement::ReasonableWidth() const
- {
- uint16 size = Main().Size().ReasonableWidth();
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-
- uint16 GrowOnRightArrangement::BestHeight() const
- {
- uint16 size = Main().Size().BestHeight();
-
- Assert( size <= maxint16 - barSize );
- size += barSize;
-
- size = Min( size, Right().Size().MaximumHeight() );
- size = Max( size, Right().Size().MinimumHeight() );
-
- return size - barSize;
- }
-
- uint16 GrowOnRightArrangement::BestHeight( uint16 bound ) const
- {
- uint16 size = Main().Size().BestHeight( bound );
-
- Assert( size <= maxint16 - barSize );
- size += barSize;
-
- size = Min( size, Right().Size().MaximumHeight() );
- size = Max( size, Right().Size().MinimumHeight() );
-
- size -= barSize;
-
- size = Min( size, bound );
-
- return size;
- }
-
- uint16 GrowOnRightArrangement::BestWidth() const
- {
- uint16 size = Main().Size().BestWidth();
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-
- uint16 GrowOnRightArrangement::BestWidth( uint16 bound ) const
- {
- if ( bound <= barSize )
- return bound;
-
- bound -= barSize;
-
- uint16 size = Main().Size().BestWidth( bound );
- size = Min( size, bound );
-
- Assert( size <= maxint16 - barSize );
-
- return size + barSize;
- }
-